import sys
import random

def f(lst):
    return list(filter(lambda num:sum(map(int,str(num)))==9,lst))

a=[[123,126,54,111111111,27,18,9,11],
   [9,90],
   [9],
   [18,81,7,18,81],
   [1233,3312,3,556465,89900,111111,99999,0],
   [3241,231432,63,343214,31311,234,423,324],
   [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19],
   [11,18,19,88,99,1116,6111],
   [3,9,9,9,9,9,9,9,9,9],
   [19,91,72,63,36,54,45,88888888,7777,333,3333]
  ]
for i  in range(10):
    fin = open('{}.in'.format(i+1),'w')
    fout = open('{}.out'.format(i+1),'w')
    print(*a[i],file=fin)
    print(*f(a[i]),file=fout)
    fin.close()
    fout.close()
